
const Dashboard = () => import( '../views/index/Dashboard')
//权限节点列表
const NodeList = () => import('../views/auth/node')
//角色列表
const RoleList = () => import('../views/auth/rolelist')
//管理人员列表
const AdminList = () => import('../views/auth/adminlist')

//banner列表
const BannerList = () => import('../views/setting/banner')


//顶级菜单
const topMenuMap = [
    {key:'index',name:'首页',icon: ''},
    {key:'sys',name:'系统',icon: ''},
    {key:'tool',name:'页面模板',icon: ''},
];

//子菜单
const slider = {
    index: [
        {
            icon: 'el-icon-loading',
			title: '系统首页',
			path: '/dashboard', //固定值其他页面有判断不能关闭此路由
			component: Dashboard,
        }
    ],
    sys: [
        {
            icon: 'el-icon-star-off',
			title: '权限管理',
            path: '#auth',
            subs: [
				{
					icon: '',
					title: '菜单节点',
				    path: '/auth/node',
				    component: NodeList,
				},
                {
					icon: '',
					title: '角色管理',
					path: '/auth/role',
					component: RoleList,	
                },
				{
					icon: '',
					title: '人员管理',
					path: '/auth/admin',
					component: AdminList,	
				},
            ]
        },
		{
		    icon: 'el-icon-s-tools',
			title: '系统设置',
		    path: '#seting',
		    subs: [
		        {
					icon: '',
					title: 'banner列表',
					path: '/banner/list',
					component: BannerList,	
		        }
		    ]
		},
    ],
    tool:[
		{
			icon: 'el-icon-date',
			title: '基础表格',
		    path: '/tpl/table',
		    component: () => import('../components/page/tpl/BaseTable.vue'),
		},
        {
            icon: 'el-icon-guide',
			title: 'tab选项卡',
			path: '/tpl/tabs',
			component: () => import('../components/page/tpl/Tabs.vue'),
        },
        {
            icon: 'el-icon-film',
			title: '表单相关',
            path: '#table',
            subs: [
                {
                    path: '/tpl/form',
					title: '基本表单',
					component: () => import('../components/page/tpl/BaseForm.vue'),
                },
                {
                    path: '#editor',
					title: '编辑器',
                    subs: [
                        {
                            path: '/tpl/editor',
							title: '富文本编辑器',
							component: () => import('../components/page/tpl/editor/VueEditor.vue'),
                        },
                        {
                            path: '/tpl/editor2',
							title: 'Tinymce5编辑器',
							component: () => import('../components/page/tpl/editor/Tinymce5.vue'),
                        },
                        {
                            path: '/tpl/markdown',
							title: 'markdown编辑器',
							component: () => import('../components/page/tpl/editor/Markdown.vue'),
                        },
                    ]
                },
                {
                    path: '/tpl/upload',
					title: '文件上传',
					component: () => import('../components/page/tpl/Upload.vue')
                }
            ]
        },
        {
            icon: 'el-icon-s-promotion',
			title: 'icon图标',
            path: '/tpl/icon',
			component: () => import('../components/page/tpl/Icon.vue')
        },
        {
            icon: 'el-icon-rank',
			title: '拖拽组件',
            path: '#drop',
            subs: [
                {
                    path: '/tpl/drag',
					title: '拖拽列表',
					component: () => import('../components/page/tpl/DragList.vue')
                },
                {
                    path: '/tpl/dialog',
					title: '拖拽弹框',
					component: () => import('../components/page/tpl/DragDialog.vue')
                }
            ]
        },
        {
            icon: 'el-icon-medal-1',
			title: '国际化功能',
            path: '/tpl/i18n',
			component: () => import('../components/page/tpl/I18n.vue')
        },
        {
            icon: 'el-icon-s-release',
            path: '#error',
			title: '错误处理',
            subs: [
                {
                    path: '/tpl/permission',
					title: '权限测试',
					component: () => import('../components/page/tpl/Permission.vue')
                },
                {
                    path: '/tpl/404',
					title: '404页面',
					component: () => import('../components/page//tpl/404.vue')
                },
				{
				    path: '/tpl/403',
					title: '403页面',
					component: () => import('../components/page/tpl/403.vue')
				},
            ]
        },
        {
            icon: 'el-icon-s-custom',
			title: '支持作者',
            path: '/tpl/donate',
			component: () => import('../components/page/tpl/Donate.vue')
        }
    ]
}


/**
 * 菜单根据层级组合
 */
export function menuRouterFunc() {
	let newList = []
	for (let item of topMenuMap) {
		 newList.push({
			 path: '#' + item.key,
			 icon: item.icon,
			 title: item.name,
			 subs: slider[item.key] || []
		 })
	}
	return newList
}
export {
    topMenuMap,
    slider
}